Skip to main content

ToJSON

Converts the ApiTablePr object into the JSON object.

Syntax

expression.ToJSON();

expression - A variable that represents a ApiTablePr class.

Parameters

This method doesn't have any parameters.

Returns

JSON

Example

This example converts the table object into the JSON object.

let doc = Api.GetDocument();
let tableStyle = doc.CreateStyle("CustomTableStyle", "table");
tableStyle.SetBasedOn(doc.GetStyle("Bordered"));
let tablePr = tableStyle.GetTablePr();
let json = tablePr.ToJSON();
let tablePrFromJSON = Api.FromJSON(json);
let type = tablePrFromJSON.GetClassType();
let paragraph = doc.GetElement(0);
paragraph.AddText("Class type = " + type);